<%@ Page Language="C#" MasterPageFile="~/Frame.Master" AutoEventWireup="true" CodeBehind="Order.aspx.cs" Inherits="BaseSystem._System.Order" Title="Untitled Page" %>

<%@ Import Namespace="Auto.Data.Common" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentHeader" runat="server">
<script type="text/javascript">
   function SetHiddenValue()
    {
        var hfValue = document.getElementById('<%=hfValue.ClientID %>');
        hfValue.value = "";
        var result = false;
        var listBox = document.getElementById('<%=lbDetails.ClientID %>');
        for(var i = 0; i < listBox.length; i++)
        {
            if(listBox[i].value!="")
            {
                hfValue.value += listBox[i].value + "|" ;
            }
        }
    }
    function moveUpDown(aim,obj)
    {
        var Obj = document.getElementById(obj);
        if(aim=="up")
        {
            if(Obj.selectedIndex !=-1 && Obj.length - Obj.selectedIndex != Obj.length)
            {
                oldSelected=Obj.selectedIndex;
                oldText=Obj.options[Obj.selectedIndex].text;
                oldValue=Obj.options[Obj.selectedIndex].value;
                Obj.options[Obj.selectedIndex]=new Option(Obj.options[Obj.selectedIndex-1].text,Obj.options[Obj.selectedIndex-1].value)
                Obj.options[oldSelected-1]=new Option(oldText,oldValue);
                Obj.options[oldSelected-1].selected=true;
            }
        }
        else if(aim=="down")
        {
            if(Obj.selectedIndex !=-1 && Obj.length - Obj.selectedIndex != 1)
            {
                current_=Obj.selectedIndex;
                current_text=Obj.options[Obj.selectedIndex].text;
                current_value=Obj.options[Obj.selectedIndex].value;
                Obj.options[Obj.selectedIndex]= new Option(Obj.options[Obj.selectedIndex+1].text,Obj.options[Obj.selectedIndex+1].value);
                Obj.options[current_+1].text=current_text;
                Obj.options[current_+1].value=current_value;      
                Obj.options[current_+1].selected=true;
            }
        }
        SetHiddenValue();
    
    }
    window.onload = function()
    {
        SetHiddenValue();
    }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentMain" runat="server">

    <asp:HiddenField ID="hfValue" runat="server" />

    <table border="0" cellpadding="0" cellspacing="2" style="width: 700px;">
        <tr>
            <td nowrap="nowrap" style="height: 217px" valign="top">
                <table>
                    <tr>
                        <td valign="top">
                            <asp:ListBox ID="lbDetails" runat="server" Height="200px" Width="300px"></asp:ListBox>
                        </td>
                        <td valign="middle" >
                       	<img border="0" src="../images/up01.gif" OnClick="javascript:moveUpDown('up','<%=lbDetails.ClientID %>');" style="cursor:pointer;">
    			        <p><img border="0" src="../images/down01.gif" OnClick="javascript:moveUpDown('down','<%=lbDetails.ClientID %>');" style="cursor:pointer;">
                    </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            &nbsp;<asp:Button ID="btnModify" runat="server" CssClass="button_bak" OnClick="btnModify_Click" Text="Confirm" /></td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</asp:Content>
